package com.shiro.config;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

import static java.time.LocalDateTime.*;

@Component
@Slf4j
public class MyMetaDataHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {

        metaObject.setValue("createTime", now());
        metaObject.setValue("updateTime", now());
        metaObject.setValue("createUser","aa");
        metaObject.setValue("updateUser","bb");

    }

    @Override
    public void updateFill(MetaObject metaObject) {

        metaObject.setValue("updateTime", now());
        metaObject.setValue("updateUser","aa");

    }
}
